package com.it.server.mapper;

import com.github.pagehelper.Page;
import com.it.pojo.Entity.Category;
import com.it.pojo.Entity.Merchant;
import com.it.pojo.VO.MerchantDetailVO;
import com.it.pojo.VO.MerchantListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MerchantMapper {
    /**
     * 查询商户列表
     * @return
     */
    @Select("Select id,name,picture,business_status,announcement from merchant")
    Page<MerchantListVO> list();
    @Select("Select id,name,picture,business_status,delivery_fee,min_order_amount,announcement,address,phone from merchant where id=#{id}")
    MerchantDetailVO detail(Integer id);
    @Select("Select id,name from category where merchant_id=#{merchantId}")
    List<Category> getCategories(Integer merchantId);
    @Select("Select id,name,picture,business_status,announcement from merchant where merchant_category_id=#{categoryId}")
    List<MerchantListVO> listCategory(Integer categoryId);


     void add(Merchant merchant);

    Merchant login(Merchant merchant);

    void update(Merchant merchant);
}
